package com.xiaoqiang.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class CheckAccount extends HttpServlet {
    public CheckAccount() {
        super();
    }

	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//HttpSession session = request.getSession();
		request.setCharacterEncoding("UTF-8");
		String username = request.getParameter("username");
		String pwd = request.getParameter("pwd");
		System.out.println(username);
		if(!(username.equals(""))){
			if(!(pwd.equals(""))){
				request.getRequestDispatcher("success.jsp").forward(request, response);
			} else{
				request.getRequestDispatcher("login.jsp").forward(request, response);
			} 
		}else{
			request.getRequestDispatcher("login.jsp").forward(request, response);
		}
	}


	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
